import React from 'react';
import ReactDOM from 'react-dom';
import registerServiceWorker from './registerServiceWorker';
import { createStore, applyMiddleware, compose } from 'redux';
import { BrowserRouter, Route, Switch } from 'react-router-dom';
import { Provider } from 'react-redux';
import thunk from 'redux-thunk';
import reducers from './reducers';
import Home from './container/home/home';
import Admin from './container/admin/admin';
import './index.css';
import Parent from './react-demo'

// redux调试工具
const devToolsExtension = window.devToolsExtension ? window.devToolsExtension() : f => f;
// 新建store, compose结合thunk和devToolsExtension
const store = createStore(reducers, compose(applyMiddleware(thunk), devToolsExtension));

ReactDOM.render(<Parent />,
	// (<Provider store = {store}>
	// 	<BrowserRouter>		
	// 		<Switch>	
	// 			{/* exact精确匹配 */}
	// 			<Route path='/' exact component={Home} />  
	// 			<Route path='/admin' component={Admin} />
	// 		</Switch>
	// 	</BrowserRouter>
	// </Provider>), 
	document.getElementById('root'));
registerServiceWorker();